/* ----------------------------------------------------------------------------
 * Copyright (c) 2008 by Airbus SAS. All rights reserved. All intellectual
 * property rights in and/or in the computer program and its related
 * documentation and technology are the sole Airbus' property. This computer
 * program is under Airbus copyright and cannot be in whole or in part
 * reproduced, sublicensed, leased, sold or used in any form or by any means,
 * including without limitation graphic, electronic, mechanical, photocopying,
 * recording, taping or information storage and retrieval systems without Airbus
 * prior written consent. The downloading, exporting or reexporting of this
 * computer program or any related documentation or technology is subject to any
 * export rules, including US regulations.
 * ----------------------------------------------------------------------------
 */

package com.azzaou.util;
import java.io.Serializable;

import javax.faces.context.FacesContext;


/**
 * BusinessException
 * 
 * @version : V1.0
 * @author : moabdi
 * @Project : [AWN_PACAT_ENGINEERING_ADMINTOOLS]
 * @Date : juil. 2012
 * @DSL_Requirements :
 * @Product_Requirements :
 */
public class BusinessException implements Serializable
{
 
  /**
   * serialVersionUID
   */
  private static final long serialVersionUID = 1L;

  /**
   * Error
   */
  private String businessError;

  /**
   * key
   */
  private String key;

  /**getCause
   * 
   * @return the message
   */
  public String getBusinessError()
  {
    businessError = BuildMessage.getMessageResourceString("i18n.businessException", key, null,
        FacesContext.getCurrentInstance().getViewRoot().getLocale());
    
    if (businessError ==null || "".equalsIgnoreCase(businessError))
    {
      businessError = "An error occurred.";
    }

    return businessError;
  }

  /**
   * setCause
   * 
   * @param pCause
   *          the message to set
   */
  public void setBusinessError(String pCause)
  {
    this.businessError = pCause;
  }

  /**
   * @return key
   */
  public String getKey()
  {
    return key;
  }

  /**
   * @param key key to define
   */
  public void setKey(String key)
  {
    this.key = key;
  }
  
  
}